# -*- coding: utf-8 -*-
import requests

def push_detail_url():
    # urls = []
    # for i in range(1,400):
    #     url = "https://zhplz.com/detail/%s/" % i
    #     res = requests.get(url,verify=False)
    #     print res.status_code
    #     if res.status_code == 200:
    #         urls.append(url)
    # print len(urls)
    # if urls:
    #     with open('_push_url.txt','a') as f:
    #         f.write('\n'.join(urls))

    baidu_url = "/urls?site=zhplz.com&token=rVj2oTp6rEVOLfxf"
    filecontents = {"file": open('_push_url.txt',"rb")}
    r = requests.post("http://data.zz.baidu.com" + baidu_url, files=filecontents)
    baiduresult = "推送结果%s \n" % (r.text).encode('utf-8')
    print  baiduresult


if __name__ == '__main__':
    push_detail_url()

# print requests.get('https://zhplz.com').status_code